home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / sys / time.h < prev    next >
C/C++ Source or Header  |  1991-06-10  |  2KB  |  75 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)time.h    7.1 (Berkeley) 6/4/86
  7.  * $Header: /sprite/src/lib/include/sys/RCS/time.h,v 1.5 91/06/10 17:21:45 kupfer Exp $
  8.  */
  9.  
  10. #ifndef _SYSTIME
  11. #define _SYSTIME
  12.  
  13. #include <cfuncproto.h>
  14.  
  15. /*
  16.  * Structure returned by gettimeofday(2) system call,
  17.  * and used in other calls.
  18.  */
  19. struct timeval {
  20.     long    tv_sec;        /* seconds */
  21.     long    tv_usec;    /* and microseconds */
  22. };
  23.  
  24. struct timezone {
  25.     int    tz_minuteswest;    /* minutes west of Greenwich */
  26.     int    tz_dsttime;    /* type of dst correction */
  27. };
  28. #define    DST_NONE    0    /* not on dst */
  29. #define    DST_USA        1    /* USA style dst */
  30. #define    DST_AUST    2    /* Australian style dst */
  31. #define    DST_WET        3    /* Western European dst */
  32. #define    DST_MET        4    /* Middle European dst */
  33. #define    DST_EET        5    /* Eastern European dst */
  34. #define    DST_CAN        6    /* Canada */
  35.  
  36. /*
  37.  * Operations on timevals.
  38.  *
  39.  * NB: timercmp does not work for >= or <=.
  40.  */
  41. #define    timerisset(tvp)        ((tvp)->tv_sec || (tvp)->tv_usec)
  42. #define    timercmp(tvp, uvp, cmp)    \
  43.     ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  44.      (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  45. #define    timerclear(tvp)        (tvp)->tv_sec = (tvp)->tv_usec = 0
  46.  
  47. /*
  48.  * Names of the interval timers, and structure
  49.  * defining a timer setting.
  50.  */
  51. #define    ITIMER_REAL    0
  52. #define    ITIMER_VIRTUAL    1
  53. #define    ITIMER_PROF    2
  54.  
  55. struct    itimerval {
  56.     struct    timeval it_interval;    /* timer interval */
  57.     struct    timeval it_value;    /* current value */
  58. };
  59.  
  60. #ifndef KERNEL
  61. #include <time.h>
  62. #endif
  63.  
  64. _EXTERN int    getitimer _ARGS_((int timer, struct itimerval *valuePtr));
  65. _EXTERN int    gettimeofday _ARGS_ ((struct timeval *tvPtr,
  66.                       struct timezone *tzPtr));
  67. _EXTERN int    settimeofday _ARGS_ ((_CONST struct timeval *tvPtr,
  68.                       _CONST struct timezone *tzPtr));
  69. _EXTERN int    setitimer _ARGS_((int timer, _CONST struct itimerval *newPtr,
  70.                   struct itimerval *oldPtr));
  71. _EXTERN int    utimes _ARGS_((_CONST char *file,
  72.                    _CONST struct timeval *tvPtr));
  73.  
  74. #endif /* _SYSTIME */
  75.